<?php
    class binhchonbs
    {
        public $MaBinhChon = 1;
        public $TieuDe = "";
        
        public $MaTuyChon = 1;
        public $TenTuyChon = "";  
        public $SapXep = 0;
        public $DuocChon = 0;
               
        public $DiaChiIp = "";
        
        public function GetPollId()
        {
            $db = new binhchondb();
            return $db->GetPollId($this->MaBinhChon);
        }
        
        public function Add()
        {
            $db = new binhchondb();
            return $db->Add($this->TenTuyChon, $this->MaBinhChon, $this->SapXep, $this->DuocChon);
        }
        
        public function GetMax()
        {
            $db = new binhchondb();
            return $db->GetMax();
        }
        
        public function Update()
        {
            $db = new binhchondb();
            return $db->Update($this->MaBinhChon, $this->TieuDe);
        }
        
        public function DeleteOption()
        {
            $db = new binhchondb();
            return $db->DeleteOption($this->MaTuyChon);
        }
        
        public function DeleteVote()
        {
            $db = new binhchondb();
            return $db->DeleteVote($this->MaTuyChon);
        }
        
        public function GetPollOption()
        {
            $db = new binhchondb();
            return $db->GetPollOption($this->MaBinhChon);
        }
        
        public function GetPollVotes()
        {
            $db = new binhchondb();
            return $db->GetPollVotes($this->MaTuyChon);
        }
        
        public function UpdatePoll()
        {
            $db = new binhchondb();
            return $db->UpdatePoll($this->MaTuyChon, $this->DiaChiIp);
        }
    }
?>